-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPC-9975 Remove use-query-params
#481
Conversation
use-query-params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks have passed and this pull request is ready for manual review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks have passed and this pull request is ready for manual review
It's built on top of `useSearchParams` from `react-router`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks have passed and this pull request is ready for manual review
The proposed solution is to use `setTimeout`, reseting the form and changing the URL are two actions that trigger a re-render. In order to avoid missbehaviours on how they get added to React's event queue, we add a `setTimeout` so the execution is done in the next tick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks have passed and this pull request is ready for manual review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks have passed and this pull request is ready for manual review
This PR is blocked by ticket HPC-10019, once the work in here is merged we can proceed on merging this PR. It can be reviewed in the meantime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks have passed and this pull request is ready for manual review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks have passed and this pull request is ready for manual review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed you said "try manipulating the URL" in the initial comment and when I did, you said in the inline comments that no one will change the URL manually :P
apps/hpc-ftsadmin/src/app/components/filters/filter-organization-table.tsx
Show resolved
Hide resolved
I should have been more specific, no user will manipulate the URL, but nonetheless, us developers we should make sure that nothing too "broken" happens in any case :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks have passed and this pull request is ready for manual review
Nature of PR
Description
This PR is related to HPC-9965, read for more context.
In this PR we focus on removing
use-query-params
package. It became obsolete since with the use ofreact-router
data API hooks (precisely,useSearchParams()
) and usingio-ts
to write runtime validation, we can achieve the same objective.We do this in order to reduce dependency of external libraries.
How to test changes
To test changes I would try to manipulate the URL to see how it reacts even to unexpected
params
and with wrong data on it.Beside this, I would focus mainly on reading logic for
useQueryParams()
to verify it really covers corner cases